﻿using System;
using UnityEngine;

public class USRecordSequence : MonoBehaviour
{
    private int captureFrameRate = 60;
    private string capturePath = string.Empty;
    private int imageCount;
    private bool isRecording;
    private int upscaleAmount = 1;

    private void LateUpdate()
    {
        Time.captureFramerate = this.captureFrameRate;
        if (this.isRecording)
        {
            Application.CaptureScreenshot(string.Concat(new object[] { this.capturePath, "/Screenshot_", this.imageCount, ".png" }), this.upscaleAmount);
            this.imageCount++;
        }
    }

    public void PauseRecording()
    {
        this.isRecording = false;
    }

    private void Start()
    {
        this.imageCount = 0;
        this.isRecording = false;
    }

    public void StartRecording()
    {
        this.isRecording = true;
    }

    public void StopRecording()
    {
        this.isRecording = false;
        this.imageCount = 0;
    }

    public int CaptureFrameRate
    {
        set
        {
            this.captureFrameRate = Mathf.Clamp(value, 1, 60);
        }
    }

    public string CapturePath
    {
        set
        {
            this.capturePath = value;
        }
    }

    public int UpscaleAmount
    {
        set
        {
            this.upscaleAmount = Mathf.Clamp(value, 1, 8);
        }
    }
}

